-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented dither noise #492
base: main
Are you sure you want to change the base?
Conversation
src/graphic/Fast3D/gfx_pc.cpp
Outdated
@@ -3886,7 +3898,7 @@ void gfx_run(Gfx* commands, const std::unordered_map<Mtx*, MtxF>& mtx_replacemen | |||
!game_renders_to_framebuffer); | |||
gfx_rapi->start_frame(); | |||
gfx_rapi->start_draw_to_framebuffer(game_renders_to_framebuffer ? game_framebuffer : 0, | |||
(float)gfx_current_dimensions.height / gfx_native_dimensions.height); | |||
gfx_calculate_noise_scale(), g_rdp.alpha_test_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing in alpha_test_value
through start_draw_to_framebuffer
means that the value is only read and set once at the very beginning of the frame.
But you implemented gfx_dp_set_blend_color
which influences this value, but it'll never be updated to the shader this way.
if (cc_features.opt_alpha && cc_features.opt_noise) { | ||
append_line( | ||
fs_buf, &fs_len, | ||
"texel.a = alphaDither(random(vec3(floor(gl_FragCoord.xy * noise_scale), float(frame_count))), texel.a);"); | ||
} else if (cc_features.opt_noise) { | ||
append_line(fs_buf, &fs_len, | ||
"texel.a *= floor(clamp(random(vec3(floor(gl_FragCoord.xy * noise_scale), float(frame_count))) + " | ||
"texel.a, 0.0, 1.0));"); | ||
"texel.rgb = colorDither(random(vec3(floor(gl_FragCoord.xy * noise_scale), float(frame_count))), " | ||
"texel.rgb);"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least from what I can see in MM, it is possible for aplha dithering and color dithering to be applied at the same time. This if / if else
does not allow that currently.
We may even need to split opt_noise
into two values, or something so that we can control which is used.
(cherry picked from commit 7321c1a)